package com.vma.jifu.controller;

import com.vma.jifu.bizModel.model.TgArticle;
import com.vma.jifu.bizModel.model.TgVedio;
import com.vma.jifu.others.TgAssistService;
import com.vma.jifu.others.impl.TgAssistServiceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by chenzui on 2017/6/23.
 */
public class TgAssistController extends BaseController {

    private TgAssistService tgAssistService = new TgAssistServiceImpl();

    public void index(){
        List<TgArticle> articles = tgAssistService.getArticles();

        List<TgVedio> vedios = tgAssistService.getVedioes();

        Map result = new HashMap();

        result.put("articles",articles);

        result.put("vedios",vedios);

        renderRes(result);
    }

    public void getArticleByPage(){
        Integer cPage = getParaToInt("cPage");

        Integer pSize = getParaToInt("pSize");

        renderRes(tgAssistService.getArticleByPage(cPage,pSize));
    }

    public void getVedioByPage(){
        Integer cPage = getParaToInt("cPage");

        Integer pSize = getParaToInt("pSize");

        renderRes(tgAssistService.getVedioByPage(cPage,pSize));
    }

    public void getArticleById(){
        Integer id = getParaToInt("id");
        renderRes(tgAssistService.getArticleById(id));
    }

    public void getVedioById(){
        Integer id = getParaToInt("id");
        renderRes(tgAssistService.getVedioById(id));
    }
}
